package task;
import java.util.Arrays;

public class Task6_7 {
    public static void bubbleSort(int[] array){
        for (int i = 0; i < array.length - 1; i++) {
            boolean h = false;
            for (int j = 0; j < array.length - 1 - i; j++) {
                if(array[j] > array[j + 1]){
                    int t = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = t;
                    h = true;
                }
            }
            if(h = false){
                return ;
            }
        }
    }

    public static void main(String[] args) {
        int[] array = {5,9,2,7,3};
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
    }
}
